package com.gaoyi.crm.control.dialog;

import androidx.fragment.app.FragmentActivity;

import com.gaoyi.crm.R;
import com.gaoyi.crm.callback.IPhotoCallBack;
import com.gaoyi.crm.util.FileUtils;
import com.gaoyi.crm.util.ToastUtil;

public class ComboDialogUtils {

    public static void showComboPicDialog(FragmentActivity activity, IPhotoCallBack callBack) {
        ComboPicDialog picDialog = ComboPicDialog.newInstance(activity);
        picDialog.setClickListener(new ComboPicDialog.OnClickListener() {
                    @Override
                    public void camera() {
                        if (FileUtils.getInstance().hasSdCard()) {
                            callBack.camera();
                            picDialog.dismiss();
                        } else {
                            ToastUtil.showToast(R.string.no_sd_card);
                        }
                    }

                    @Override
                    public void file() {
                        callBack.file();
                        picDialog.dismiss();
                    }

                    @Override
                    public void cancel() {
                        picDialog.dismiss();
                    }
                })
                .setCanceledOnTouchOutside(true)
                .show(activity.getSupportFragmentManager());
    }
}
